function break_ = gXtakeABreak(varargin)
%A countdown clock and some music for taking a break
%
%   Clock color arguments are optional:
%   faceColor = varargin{1};
%   handsColor = varargin{2};

% Copyright 2008 by Benjamin Heasly at University of Pennsylvania

if nargin > 1
    handsColor = varargin{2};
else
    handsColor = [24 8 4 255];
end

if nargin
    faceColor = varargin{1};
else
    faceColor = [4 2 24 255];
end

% make a clock face with concentric circles
R = 5;
arg_dXtarget = { ...
    'x',        0, ...
    'y',        0, ...
    'diameter', {2*R, R/16}, ...
    'color',    {faceColor, handsColor}};

% a nice message and a time counter
arg_dXtext = { ...
    'x',        {-4.5, -.5}, ...
    'y',        {-(R+2), R+1}, ...
    'size',     {40, 30}, ...
    'string',   {'Tick a little break...', '##'}, ...
    'color',    handsColor};

% a seconds hand and 4 tick marks
r = .9*R;
arg_dXline = { ...
    'x1',       {0, 0, r, 0,-r}, ...
    'x2',       {0, 0, R, 0,-R}, ...
    'y1',       {0, r, 0,-r, 0}, ...
    'y2',       {r, R, 0,-R, 0}, ...
    'color',    handsColor, ...
    'penWidth', 2};

% an empty sound object
arg_dXsound = { ...
    'mute',         false, ...
    'rawSound',     []};

% {'group', reuse, setnow, setalways}
reswap = {mfilename, false, true, true};
break_ = { ...
    'dXtext',       2,	reswap,	arg_dXtext; ...
    'dXline',       5,	reswap,	arg_dXline; ...
    'dXtarget',     2,	reswap,	arg_dXtarget; ...
    'dXsound',      1,  reswap, arg_dXsound; ...
    };